import UIKit

extension UITableView {
    
    func register<T: UITableViewCell>(cellClass type: T.Type) {
        register(type, forCellReuseIdentifier: String(describing: type))
    }
    
    func register<T: UITableViewCell>(cellNib type: T.Type) {
        let nib = UINib(nibName: String(describing: type), bundle: Bundle(for: type))
        register(nib, forCellReuseIdentifier: String(describing: type))
    }
    
    func dequeueReusableCell<T: UITableViewCell>(_ type: T.Type) -> T {
        return dequeueReusableCell(withIdentifier: String(describing: type)) as! T
    }
    
    func dequeueReusableCell<T: UITableViewCell>(_ type:T.Type, indexPath : IndexPath) -> T {
        return dequeueReusableCell(withIdentifier: String(describing: type), for: indexPath) as! T
    }
    
    
}
